<?php
/* @var $this TicketController */
/* @var $ticket Ticket */
/* @var $form CActiveForm */
?>
<div class="form">
	<div class="section">
		<div class="block">
			<?php
			$form = $this->beginWidget('CActiveForm', array(
				'id' => 'ticket-create-form',
				'enableAjaxValidation' => false,
			));
			?>
			<table class="form-table">
				<tr>
					<th scope="row" width="100"><?php echo $form->labelEx($ticket, 'name'); ?></th>
					<td>
						<?php echo $form->textField($ticket, 'name', array('size' => 30)); ?>
						<?php echo $form->error($ticket, 'name'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row" width="100"><?php echo $form->labelEx($ticket, 'email'); ?></th>
					<td>
						<?php echo $form->textField($ticket, 'email', array('size' => 30)); ?>
						<?php echo $form->error($ticket, 'email'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row" width="100"><?php echo $form->labelEx($ticket, 'mobile'); ?></th>
					<td>
						<?php echo $form->textField($ticket, 'mobile', array('size' => 30)); ?>
						<?php echo $form->error($ticket, 'mobile'); ?>
					</td>
				</tr>
				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
				<?php if (!$ticket->isNewRecord): ?>
					<tr>
						<th scope="row" width="100"><?php echo $form->labelEx($ticket, 'current_status', array('label' => 'Status')); ?></th>
						<td>
							<?php echo $form->dropDownList($ticket, 'current_status', CHtml::listData(TicketStatusType::model()->findAll(), 'code', 'code')); ?>
							<?php echo $form->error($ticket, 'current_status'); ?>
						</td>
					</tr>
				<?php endif; ?>
				<tr>
					<th scope="row" width="100"><?php echo $form->labelEx($ticket, 'type'); ?></th>
					<td>
						<?php echo $form->dropDownList($ticket, 'type', CHtml::listData(TicketType::model()->findAll(), 'code', 'name')); ?>
						<?php echo $form->error($ticket, 'type'); ?>
					</td>
				</tr>
				<tr class="ticket-reference" style="<?php echo (in_array($ticket->type, array('Salesperson', 'Transaction')) ? "" : "display: none;"); ?>">
					<th scope="row" width="100">
						<?php echo $form->labelEx($ticket, 'reference', array('label' => $ticket->getReferenceLabel())); ?>
					</th>
					<td>
						<?php echo $form->textField($ticket, 'reference', array('size' => '60')); ?>
						<?php echo $form->error($ticket, 'reference'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row">
						<?php echo $form->labelEx($ticket, 'source'); ?></th>
					<td>
						<?php echo $form->dropDownList($ticket, 'source', CHtml::listData(TicketSource::model()->findAll(), 'code', 'code'), array('prompt' => 'Select Source')); ?>
						<?php echo $form->error($ticket, 'source'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row">
						<?php echo $form->labelEx($ticket, 'subject'); ?></th>
					<td>
						<?php echo $form->textField($ticket, 'subject', array('size' => 60)); ?>
						<?php echo $form->error($ticket, 'subject'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row">
						<?php echo $form->labelEx($ticket, 'summary'); ?></th>
					<td>
						<?php echo $form->textArea($ticket, 'summary', array('cols' => 60, 'rows' => 5)); ?>
						<?php echo $form->error($ticket, 'summary'); ?>
					</td>
				</tr>
			</table>
			<div class="row buttons">
				<?php if ($ticket->isNewRecord): ?>
					<?php echo CHtml::submitButton('Submit Ticket', array('class' => 'green')); ?>
				<?php else: ?>
					<?php echo CHtml::submitButton('Update Ticket', array('class' => 'green')); ?>
				<?php endif; ?>

			</div>
			<?php $this->endWidget(); ?>
		</div>
	</div>
</div><!-- form -->